Repository navigation
fix(libkernel): preserve condition signals across cancellation - #6091
Merged
adriadam10 merged 1 commit intoOct 18, 2026
Merged
Conversation
12 tasks done
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
This was referenced Oct 15, 2026
Merged
Closed
11 tasks done
Collaborator
|
Checked the cancellation path in |
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When a condition signal selects a waiter that is canceled while reacquiring its mutex, that waiter exits without returning the signal. A second waiter can remain blocked indefinitely. On main, the deterministic two-waiter reproduction sends one signal, cancels the selected waiter while the signaler still holds the mutex, and the survivor times out.
Condition wait completion now restores mutex ownership and recursive depth, makes one cancellation decision, and forwards a notification before cancellation cleanup. The host condition state is held separately across the wait: a caller can destroy and free its condition after notification while the awakened waiter is still reacquiring the mutex. The retained owner is explicitly released before guest thread exit, which does not unwind C++ stack objects.
The behavior follows the POSIX condition wait and cancellation contract. Cancellation may produce a spurious wake, which the contract permits. Console cancellation ordering and signal replacement remain unmeasured and are recorded in technical debt.
Tested
Windows 11 Pro build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT POSIX SEH r7, Release,
BUILD_TESTING=ON, fullbuild-runtimeconfiguration.fa539dd9, unchanged production: existing cancellation recovery tests pass. The public-API scratch reproduction leaves the survivor atETIMEDOUT; the new registered recovery case fails in 2.22 s after the selected waiter exits canceled.f59d91ffc. All 19 targeted synchronization/runtime and patched-library tests passed without skips; the final run completed in 0.58 s. Conventions, whitespace, test registration, the repository overlap checker and two independent source/test reviews passed.errnoaround sleep; fix(shader): accept TYPE=0 images during materialization #5473 inherits identical relevant blobs; test: organize library tests and label CTest suites #6044 only relocates unchanged tests; fix(libkernel): answer a second scePthreadJoin with ESRCH #4481/fix(libkernel): keep a finished Windows thread's stack until it is joined or detached #4563 concern join and stack lifetime.PthreadCondPrivateis unchanged in all 23 shared header PRs. No other open PR implements this fix.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)